/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.qdu.servlet;

import com.qdu.entity.ActiSingUp;
import com.qdu.service.ActivityService;
import java.io.IOException;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 *
 * @author 19645
 */
@WebServlet("/profile")
public class UserInfoServlet extends HttpServlet {

    ActivityService activityService = new ActivityService();

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //获取用户id
        HttpSession session = req.getSession();
        String uid = null;
        uid = (String) session.getAttribute("PageUid");
        //根据
        if (uid == null) {
            resp.sendRedirect("Userlogin.html");
        } else {
            //通过用户id获取我的活动列表
            List<ActiSingUp> signUpList = activityService.findSingUpUsers(uid);
            req.setAttribute("SignUpList", signUpList);
            
            req.getRequestDispatcher("/profile.jsp").forward(req, resp);
        }
    }

}
